** Web Appendix A
*** Shares of "Keynesians": L=.75, M=.85, H=1
use "Simulation_7585100", clear


* How often is H's coefficient greater than those of M and L and significantly different from 0?
su estimate_H p_H if estimate_H>estimate_M & estimate_H>estimate_L & p_H<=.05 & parm=="diff"
su estimate_H p_H if estimate_H>estimate_M & estimate_H>estimate_L & p_H<=.05 & parm=="PW" 
su estimate_H p_H if estimate_H>estimate_M & estimate_H>estimate_L & p_H<=.05 & parm=="LDV"


** Only the rich matter
su estimate_H if estimate_H>0 & p_H<=.05 & (p_M>0.05 | estimate_M<0 & p_M<=.05) & (p_L>0.05 | estimate_L<0 & p_L<=.05) & parm=="diff"
su estimate_H if estimate_H>0 & p_H<=.05 & (p_M>0.05 | estimate_M<0 & p_M<=.05) & (p_L>0.05 | estimate_L<0 & p_L<=.05) & parm=="PW" 
su estimate_H if estimate_H>0 & p_H<=.05 & (p_M>0.05 | estimate_M<0 & p_M<=.05) & (p_L>0.05 | estimate_L<0 & p_L<=.05) & parm=="LDV"

* First-difference regression
twoway ///
(hist estimate_H if parm=="diff", lcolor(blue%25) fcolor(blue%25) bin(50) xtitle("Point estimate", size("large")) ytitle("Density", size("large")) xlabel(, labsize("large")) ylabel(0(30)60, labsize("large"))) ///
(hist estimate_M if parm=="diff", lcolor(green%25) fcolor(green%25) bin(50)) ///
(hist estimate_L if parm=="diff", lcolor(red%25) fcolor(red%25) bin(50)),  legend(off) title("First-difference regression", size("large")) ///
text(54 -.007285 "L", place(n) color(red)) text(54 .0217559 "M", place(n) color(green)) text(54 .0644664 "H", place(n) color(blue))


* Prais-Winsten regression
twoway ///
(hist estimate_H if parm=="PW", lcolor(blue%25) fcolor(blue%25) bin(50) xtitle("Point estimate", size("large")) ytitle("Density", size("large")) xlabel(, labsize("large")) ylabel(0(25)50, labsize("large"))) ///
(hist estimate_M if parm=="PW", lcolor(green%25) fcolor(green%25) bin(50)) ///
(hist estimate_L if parm=="PW", lcolor(red%25) fcolor(red%25) bin(50)),  legend(off) title("Prais-Winsten regression", size("large")) ///
text(45 -.0139816 "L", place(n) color(red)) text(45 .0423418 "M", place(n) color(green)) text(45 .1225892 "H", place(n) color(blue))


* LDV regression
twoway ///
(hist estimate_H if parm=="LDV", lcolor(blue%25) fcolor(blue%25) bin(50) xtitle("Point estimate", size("large")) ytitle("Density", size("large")) xlabel(, labsize("large")) ylabel(0(10)20, labsize("large"))) ///
(hist estimate_M if parm=="LDV", lcolor(green%25) fcolor(green%25) bin(50)) ///
(hist estimate_L if parm=="LDV", lcolor(red%25) fcolor(red%25) bin(50)),  legend(off) title("LDV regression", size("large")) ///
text(18 -.0128841 "L", place(n) color(red)) text(18 .0404443 "M", place(n) color(green)) text(18 .1170918 "H", place(n) color(blue))


* P-values:
** FD
twoway ///
(hist p_H if parm=="diff", lcolor(blue%25) fcolor(blue%25) bin(50) xtitle("P-value", size("large")) ytitle("Density", size("large")) xlabel(, labsize("large")) ylabel(0(60)120, labsize("large"))) ///
(hist p_M if parm=="diff", lcolor(green%25) fcolor(green%25) bin(50)) ///
(hist p_L if parm=="diff", lcolor(red%25) fcolor(red%25) bin(50)),  legend(off) 

** PW
twoway ///
(hist p_H if parm=="PW", lcolor(blue%25) fcolor(blue%25) bin(50)  xtitle("P-value", size("large")) ytitle("Density", size("large")) xlabel(, labsize("large")) ylabel(0(75)150, labsize("large"))) ///
(hist p_M if parm=="PW", lcolor(green%25) fcolor(green%25) bin(50)) ///
(hist p_L if parm=="PW", lcolor(red%25) fcolor(red%25) bin(50)),  legend(off) 

** LDV
twoway ///
(hist p_H if parm=="LDV", lcolor(blue%25) fcolor(blue%25) bin(50)   xtitle("P-value", size("large")) ytitle("Density", size("large")) xlabel(, labsize("large")) ylabel(0(30)60, labsize("large"))) ///
(hist p_M if parm=="LDV", lcolor(green%25) fcolor(green%25) bin(50)) ///
(hist p_L if parm=="LDV", lcolor(red%25) fcolor(red%25) bin(50)),  legend(off) 

* Combined
graph combine diff_main.gph PW_main.gph LDV_main.gph diff_main_p.gph PW_main_p.gph  LDV_main_p.gph , r(2) title("(a) {it:L} = .75, {it:M} = .85, {it:H} = 1")

******* ******* ******* ******* ******* *******
*** Shares of "Keynesians": L=.90, M=.95, H=1
use "Simulation_9095100", clear

* How often is H's coefficient greater than those of M and L and significantly different from 0?
su estimate_H p_H if estimate_H>estimate_M & estimate_H>estimate_L & p_H<=.05 & parm=="diff"
su estimate_H p_H if estimate_H>estimate_M & estimate_H>estimate_L & p_H<=.05 & parm=="PW" 
su estimate_H p_H if estimate_H>estimate_M & estimate_H>estimate_L & p_H<=.05 & parm=="LDV"

** Only the rich matter 
su estimate_H if estimate_H>0 & p_H<=.05 & (p_M>0.05 | estimate_M<0 & p_M<=.05) & (p_L>0.05 | estimate_L<0 & p_L<=.05) & parm=="diff" 
su estimate_H if estimate_H>0 & p_H<=.05 & (p_M>0.05 | estimate_M<0 & p_M<=.05) & (p_L>0.05 | estimate_L<0 & p_L<=.05) & parm=="PW" 
su estimate_H if estimate_H>0 & p_H<=.05 & (p_M>0.05 | estimate_M<0 & p_M<=.05) & (p_L>0.05 | estimate_L<0 & p_L<=.05) & parm=="LDV" 

* First-difference regression
twoway ///
(hist estimate_H if parm=="diff", lcolor(blue%25) fcolor(blue%25) bin(50) xtitle("Point estimate", size("large")) ytitle("Density", size("large")) xlabel(, labsize("large")) ylabel(0(30)60, labsize("large"))) ///
(hist estimate_M if parm=="diff", lcolor(green%25) fcolor(green%25) bin(50)) ///
(hist estimate_L if parm=="diff", lcolor(red%25) fcolor(red%25) bin(50)),  legend(off) title("First-difference regression", size("large")) ///
text(54 .0182756  "L", place(n) color(red)) text(54 .0320657 "M", place(n) color(green)) text(54 .0458989  "H", place(n) color(blue))

* Prais-Winsten regression
twoway ///
(hist estimate_H if parm=="PW", lcolor(blue%25) fcolor(blue%25) bin(50) xtitle("Point estimate", size("large")) ytitle("Density", size("large")) xlabel(, labsize("large")) ylabel(0(20)40,labsize("large"))) ///
(hist estimate_M if parm=="PW", lcolor(green%25) fcolor(green%25) bin(50)) ///
(hist estimate_L if parm=="PW", lcolor(red%25) fcolor(red%25) bin(50)),  legend(off) title("Prais-Winsten regression", size("large")) ///
text(36 .0467732 "L", place(n) color(red)) text(36 .0873521 "M", place(n) color(green)) text(36 .1246338 "H", place(n) color(blue))

* LDV regression
twoway ///
(hist estimate_H if parm=="LDV", lcolor(blue%25) fcolor(blue%25) bin(50) xtitle("Point estimate", size("large")) ytitle("Density", size("large")) xlabel(, labsize("large")) ylabel(0(10)20, labsize("large"))) ///
(hist estimate_M if parm=="LDV", lcolor(green%25) fcolor(green%25) bin(50)) ///
(hist estimate_L if parm=="LDV", lcolor(red%25) fcolor(red%25) bin(50)),  legend(off) title("LDV regression", size("large")) ///
text(18 .0313761 "L", place(n) color(red)) text(18 .0577499 "M", place(n) color(green)) text(18 .0831124 "H", place(n) color(blue))

* P-values:
** FD
twoway ///
(hist p_H if parm=="diff", lcolor(blue%25) fcolor(blue%25) bin(50) xtitle("P-value", size("large")) ytitle("Density", size("large")) xlabel(, labsize("large")) ylabel(0(10)20,labsize("large"))) ///
(hist p_M if parm=="diff", lcolor(green%25) fcolor(green%25) bin(50)) ///
(hist p_L if parm=="diff", lcolor(red%25) fcolor(red%25) bin(50)),  legend(off) 

** PW
twoway ///
(hist p_H if parm=="PW", lcolor(blue%25) fcolor(blue%25) bin(50)  xtitle("P-value", size("large")) ytitle("Density", size("large")) xlabel(, labsize("large")) ylabel(0(15)30,labsize("large"))) ///
(hist p_M if parm=="PW", lcolor(green%25) fcolor(green%25) bin(50)) ///
(hist p_L if parm=="PW", lcolor(red%25) fcolor(red%25) bin(50)),  legend(off) 

** LDV
twoway ///
(hist p_H if parm=="LDV", lcolor(blue%25) fcolor(blue%25) bin(50) xtitle("P-value", size("large")) ytitle("Density", size("large")) xlabel(, labsize("large")) ylabel(0(15)30,labsize("large"))) ///
(hist p_M if parm=="LDV", lcolor(green%25) fcolor(green%25) bin(50)) ///
(hist p_L if parm=="LDV", lcolor(red%25) fcolor(red%25) bin(50)),  legend(off) 

** Combined
graph combine diff_main.gph PW_main.gph LDV_main.gph diff_main_p.gph PW_main_p.gph  LDV_main_p.gph , r(2) title("(b) {it:L} = .90, {it:M} = .95, {it:H} = 1")



** Web Appendix B
use "micro data - web appendix B", clear

xtset ccode year
* Regression of social spending on preferences 
xtpcse inter_socialspending pre_10 inter_plus65 unemp ln_gdp_cap realgdpgr i.year, p c(a) hetonly
xtpcse inter_socialspending pre_50 inter_plus65 unemp ln_gdp_cap realgdpgr  i.year, p c(a) hetonly
xtpcse inter_socialspending pre_90 inter_plus65 unemp ln_gdp_cap realgdpgr  i.year, p c(a) hetonly
xtpcse inter_socialspending pre_10 pre_50 pre_90 inter_plus65 unemp ln_gdp_cap realgdpgr  i.year, p c(a) hetonly
 
* includes country dummies
xtpcse inter_socialspending pre_10 inter_plus65 unemp ln_gdp_cap realgdpgr  i.year i.ccode, p c(a) hetonly
xtpcse inter_socialspending pre_50 inter_plus65 unemp ln_gdp_cap realgdpgr  i.year i.ccode, p c(a) hetonly
xtpcse inter_socialspending pre_90 inter_plus65 unemp ln_gdp_cap realgdpgr  i.year i.ccode, p c(a) hetonly
xtpcse inter_socialspending pre_10 pre_50 pre_90 inter_plus65 unemp ln_gdp_cap realgdpgr  i.year i.ccode, p c(a) hetonly
 
 
 
** Web Appendix C
use "CSES_replication_data.dta", clear

* Table C1
oprobit pol_knowledge income_q2 income_q3 income_q4 income_q5 if ccode==900 | ccode ==305 | ccode ==211 | ccode ==20 | ccode ==390 | ccode ==375 | ccode ==220 | ccode ==260 | ccode ==395   | ccode ==205 | ccode ==325 | ccode == 740 | ccode ==210 | ccode ==920 | ccode ==385 | ccode ==235 | ccode ==230 | ccode ==380 | ccode ==225 | ccode==200 | ccode ==2, vce(cluster ccode)

oprobit pol_knowledge income_q2 income_q3 income_q4 income_q5 education_L2 education_L3 education_L4 education_L5 if ccode==900 | ccode ==305 | ccode ==211 | ccode ==20 | ccode ==390 | ccode ==375 | ccode ==220 | ccode ==260 | ccode ==395   | ccode ==205 | ccode ==325 | ccode == 740 | ccode ==210 | ccode ==920 | ccode ==385 | ccode ==235 | ccode ==230 | ccode ==380 | ccode ==225 | ccode==200 | ccode ==2, vce(cluster ccode)


* Predicted probabilities
oprobit pol_knowledge income_q2 income_q3 income_q4 income_q5 if ccode==900 | ccode ==305 | ccode ==211 | ccode ==20 | ccode ==390 | ccode ==375 | ccode ==220 | ccode ==260 | ccode ==395   | ccode ==205 | ccode ==325 | ccode == 740 | ccode ==210 | ccode ==920 | ccode ==385 | ccode ==235 | ccode ==230 | ccode ==380 | ccode ==225 | ccode==200 | ccode ==2, vce(cluster ccode)

predict pred_knowledge_1, outcome(#1)

predict pred_knowledge_4, outcome(#4)

tab pred_knowledge_1 if income_q1==1

tab pred_knowledge_1 if income_q5==1

tab pred_knowledge_4 if income_q1==1

tab pred_knowledge_4 if income_q5==1



** Web Appendix F
use "LIS_replication_data", clear

g tr_1pct=tr_1*100
g tr_5pct=tr_5*100
g insurance_tr_5pct=insurance_tr_5*100
g insurance50_tr_5pct=insurance50_tr_5*100

g ln_impute_openc=ln(impute_openc)

g trend=1+year-1974


xtset ccode year
 * Table F1
xtreg tr_5pct p90p50 p50p10 ln_impute_openc impute_kaopen labfopar realgdpgr elderly vturn ud_ipol adjcov_ipol  c.trend##c.trend, fe robust
xtreg tr_5pct p90p50 p50p10  ln_impute_openc impute_kaopen ma_gov20 labfopar realgdpgr elderly vturn ud_ipol adjcov_ipol  c.trend##c.trend, fe robust
xtreg insurance_tr_5pct p90p50 p50p10 ln_impute_openc impute_kaopen labfopar realgdpgr elderly vturn ud_ipol adjcov_ipol  c.trend##c.trend, fe robust
xtreg insurance_tr_5pct p90p50 p50p10 ln_impute_openc impute_kaopen  ma_gov20 labfopar realgdpgr elderly vturn ud_ipol adjcov_ipol c.trend##c.trend, fe robust 

 * Table F2
xtreg tr_5pct p90p50 p50p10 ln_impute_openc impute_kaopen labfopar c.trend##c.trend, re robust
xtreg tr_5pct p90p50 p50p10 ln_impute_openc impute_kaopen  ma_gov20 labfopar  c.trend##c.trend, re robust
xtreg tr_5pct p90p50 p50p10 ln_impute_openc impute_kaopen labfopar realgdpgr elderly vturn i.prop c.trend##c.trend, re robust
xtreg tr_5pct p90p50 p50p10 ln_impute_openc impute_kaopen  ma_gov20 labfopar realgdpgr elderly vturn i.prop c.trend##c.trend, re robust
xtreg insurance_tr_5pct p90p50 p50p10 ln_impute_openc impute_kaopen labfopar c.trend##c.trend, re robust
xtreg insurance_tr_5pct p90p50 p50p10  ln_impute_openc impute_kaopen ma_gov20 labfopar c.trend##c.trend, re robust
xtreg insurance_tr_5pct p90p50 p50p10 ln_impute_openc impute_kaopen labfopar realgdpgr elderly vturn i.prop c.trend##c.trend, re robust
xtreg insurance_tr_5pct p90p50 p50p10 ln_impute_openc impute_kaopen  ma_gov20 labfopar realgdpgr elderly vturn i.prop c.trend##c.trend , re robust

 * Table F3
xtreg tr_1pct p90p50 p50p10 ln_impute_openc impute_kaopen labfopar c.trend##c.trend, fe robust
xtreg tr_1pct p90p50 p50p10 ln_impute_openc impute_kaopen ma_gov20 labfopar c.trend##c.trend, fe robust
xtreg tr_1pct p90p50 p50p10  ln_impute_openc impute_kaopen labfopar realgdpgr elderly vturn ud_ipol adjcov_ipol c.trend##c.trend, fe robust
xtreg tr_1pct p90p50 p50p10 ln_impute_openc impute_kaopen ma_gov20 labfopar realgdpgr elderly vturn ud_ipol adjcov_ipol c.trend##c.trend, fe robust
 
 * calculating effect sizes:
 xtreg tr_1pct p90p50 p50p10 ln_impute_openc impute_kaopen ma_gov20 labfopar c.trend##c.trend, fe robust
 estat sum
 * Effect size for partisanship
 di (1)*(6.475184*.379007)
 di 2.4541401/ 8.096887 
  
 * Table F4
xtreg insurance50_tr_5pct p90p50 p50p10 ln_impute_openc impute_kaopen labfopar  c.trend##c.trend, fe robust
xtreg insurance50_tr_5pct p90p50 p50p10 ln_impute_openc impute_kaopen  ma_gov20 labfopar c.trend##c.trend, fe robust
xtreg insurance50_tr_5pct p90p50 p50p10 ln_impute_openc impute_kaopen labfopar  elderly vturn ud_ipol adjcov_ipol  c.trend##c.trend, fe robust
xtreg insurance50_tr_5pct p90p50 p50p10 ln_impute_openc impute_kaopen  ma_gov20 labfopar  elderly vturn ud_ipol adjcov_ipol c.trend##c.trend, fe robust
 


** Web Appendix G
use  "Median_to_mean_income_1985_2010", clear

* Figure G1
twoway (scatter mm_2010 mm_1985, msymbol(none) mlabel(iso2)  mlabpos(0) mlabsize("medium") mcolor(black)) ///
 (function y=x, ra(.7 1) color(black)), ytitle("Median to mean income ~2010", size("medium")) xtitle("Median to mean income ~1985", size("medium")) xlabel(.7(.1)1, labsize("medium")) ylabel(.7(.1)1, labsize("medium") angle(horizontal)) ymtick(.7(.05)1) xmtick(.7(.05)1) legend(off)
 
 
